/*     */ package com.qmsk.business.shopList;
/*     */ 
/*     */ import com.qmsk.business.info.shop.dao.ShopDAO;
/*     */ import com.utils.basic.ObjectComm;
/*     */ import com.utils.gson.in.GsonHeadManyRows;
/*     */ import com.utils.gson.in.GsonHeadOneRow;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class ShopMap
/*     */ {
/*  13 */   private static ShopMap shopMap = null;
/*  14 */   private static Map<Long, ShopInfo> listMap = new HashMap();
/*  15 */   private static Map<Long, ShopInfo> listMap2 = new HashMap();
/*  16 */   private static ShopInfo shopInfoDefault = null;
/*     */ 
/*     */   public static ShopMap getInstance() {
/*  19 */     return shopMap;
/*     */   }
/*     */ 
/*     */   public static void setInstance(ShopMap s) {
/*  23 */     shopMap = s;
/*     */   }
/*     */ 
/*     */   public static void init() throws Exception {
/*  27 */     shopInfoDefault = null;
/*  28 */     ShopDAO dao = new ShopDAO();
/*  29 */     GsonHeadManyRows g = dao.getShopOfGroup();
/*  30 */     if (g != null)
/*  31 */       for (int i = 0; i < g.getDataLength(); ++i) {
/*  32 */         ShopInfo u = new ShopInfo();
/*  33 */         Boolean paySms = ObjectComm.objectToBoolean(
/*  34 */           g.getValueOfName("paySms", i), Boolean.valueOf(false));
/*  35 */         Long shopId = ObjectComm.objectToLong(
/*  36 */           g.getValueOfName("id", i), Integer.valueOf(0));
/*  37 */         u.setMsgURL((String)g.getValueOfName("msgUrl", i));
/*  38 */         u.setMsgPassword((String)g.getValueOfName("msgPwd", i));
/*  39 */         u.setMsgAccount((String)g.getValueOfName("msgAcct", i));
/*  40 */         u.setMsgSignature((String)g.getValueOfName("msgSign", i));
/*  41 */         u.setShopID(shopId);
/*  42 */         u.setPaySms(paySms);
/*  43 */         u.setStatus(ObjectComm.objectToInteger(g.getValueOfName(
/*  44 */           "status", i)));
/*  45 */         u.setMsgType((String)g.getValueOfName("msgType", i));
/*  46 */         u.setShopFlag((String)g.getValueOfName("cardFlag", i));
/*  47 */         u.setOutId(ObjectComm.objectToLong(g.getValueOfName("outId", i)));
/*  48 */         u.setAddress((String)g.getValueOfName("addr", i));
/*  49 */         u.setImgURL((String)g.getValueOfName("imgURL", i));
/*  50 */         u.setTel((String)g.getValueOfName("tel", i));
/*  51 */         u.setMp((String)g.getValueOfName("mp", i));
/*  52 */         u.setShopName((String)g.getValueOfName("name", i));
/*  53 */         u.setShortName((String)g.getValueOfName("sName", i));
/*  54 */         u.setLat(ObjectComm.objectToDouble(g.getValueOfName("lat", i)));
/*  55 */         u.setLng(ObjectComm.objectToDouble(g.getValueOfName("lng", i)));
/*  56 */         u.setShareMember(Boolean.valueOf(ObjectComm.objectToInteger(
/*  57 */           g.getValueOfName("shareMember", i), Integer.valueOf(0)).intValue() == 
/*  57 */           1));
/*     */ 
/*  59 */         u.setGroupId(ObjectComm.objectToLong(g.getValueOfName(
/*  60 */           "groupId", i)));
/*  61 */         listMap.put(shopId, u);
/*  62 */         if ((shopInfoDefault == null) && (u.getGroupId() != null)) {
/*  63 */           shopInfoDefault = u;
/*     */         }
/*  65 */         if ((u.getOutId() != null) && (u.getOutId().longValue() > 0L))
/*  66 */           listMap2.put(u.getOutId(), u);
/*     */       }
/*     */   }
/*     */ 
/*     */   public static Boolean getShareMemberOfShopId(Long shopId)
/*     */   {
/*  73 */     return getShareMemberOfShopIdDef(shopId, false);
/*     */   }
/*     */ 
/*     */   public static Boolean getShareMemberOfShopIdDef(Long shopId, boolean bValue) {
/*  77 */     ShopInfo u = (ShopInfo)listMap.get(shopId);
/*  78 */     if (u == null) {
/*  79 */       return Boolean.valueOf(bValue);
/*     */     }
/*  81 */     return u.getShareMember();
/*     */   }
/*     */ 
/*     */   public static Long getOutIdOfShopId(Long shopId)
/*     */   {
/*  86 */     ShopInfo u = (ShopInfo)listMap.get(shopId);
/*  87 */     if (u == null) {
/*  88 */       return null;
/*     */     }
/*  90 */     return u.getOutId();
/*     */   }
/*     */ 
/*     */   public static Long getOutIdOfShopIdZero(Long shopId)
/*     */   {
/*  95 */     return getOutIdOfShopId(shopId, Long.valueOf(0L));
/*     */   }
/*     */ 
/*     */   public static Long getOutIdOfShopId(Long shopId, Long lDefault) {
/*  99 */     ShopInfo u = (ShopInfo)listMap.get(shopId);
/* 100 */     if (u == null) {
/* 101 */       return lDefault;
/*     */     }
/* 103 */     if (u.getOutId() == null) {
/* 104 */       return lDefault;
/*     */     }
/* 106 */     return u.getOutId();
/*     */   }
/*     */ 
/*     */   public static Long getGroupIdOfShopIdDef(Long shopId)
/*     */   {
/* 112 */     if (shopInfoDefault != null) {
/* 113 */       return getGroupIdOfShopId(shopId, shopInfoDefault.getGroupId());
/*     */     }
/* 115 */     return getGroupIdOfShopId(shopId, Long.valueOf(0L));
/*     */   }
/*     */ 
/*     */   public static Long getGroupIdOfShopId(Long shopId)
/*     */   {
/* 120 */     ShopInfo u = (ShopInfo)listMap.get(shopId);
/* 121 */     if (u == null) {
/* 122 */       return null;
/*     */     }
/* 124 */     return u.getGroupId();
/*     */   }
/*     */ 
/*     */   public static Long getGroupIdOfShopId(Long shopId, Long lDefault)
/*     */   {
/* 129 */     ShopInfo u = (ShopInfo)listMap.get(shopId);
/* 130 */     if (u == null) {
/* 131 */       return lDefault;
/*     */     }
/* 133 */     if (u.getGroupId() == null) {
/* 134 */       return lDefault;
/*     */     }
/* 136 */     return u.getGroupId();
/*     */   }
/*     */ 
/*     */   public static Long getShopIdOfOutId(Long outId)
/*     */   {
/* 142 */     ShopInfo u = (ShopInfo)listMap2.get(outId);
/* 143 */     if (u == null) {
/* 144 */       return null;
/*     */     }
/* 146 */     return u.getShopID();
/*     */   }
/*     */ 
/*     */   public static synchronized void reInitial() throws Exception
/*     */   {
/* 151 */     listMap.clear();
/* 152 */     listMap2.clear();
/* 153 */     init();
/*     */   }
/*     */ 
/*     */   public static GsonHeadOneRow getHeadOneRowOfShopId(Long shopId) {
/* 157 */     ShopInfo u = (ShopInfo)listMap.get(shopId);
/* 158 */     if (u == null) {
/* 159 */       return null;
/*     */     }
/* 161 */     String[] heads = { "outId", "addr", "imgURL", "tel", 
/* 162 */       "mp", "name", "sName", "lat", "lng", "groupId" };
/* 163 */     Object[] dates = { u.getOutId(), u.getAddress(), 
/* 164 */       u.getImgURL(), u.getTel(), u.getMp(), u.getShopName(), 
/* 165 */       u.getShortName(), u.getLat(), u.getLng(), u.getGroupId() };
/* 166 */     return new GsonHeadOneRow(heads, dates);
/*     */   }
/*     */ 
/*     */   public static String getCardFlagOfShopId(Long shopId)
/*     */   {
/* 171 */     ShopInfo u = (ShopInfo)listMap.get(shopId);
/* 172 */     if (u == null) {
/* 173 */       return null;
/*     */     }
/* 175 */     return u.getShopFlag();
/*     */   }
/*     */ 
/*     */   public static ShopInfo getShopInfoOfId(Long shopId)
/*     */   {
/* 180 */     return ((ShopInfo)listMap.get(shopId));
/*     */   }
/*     */ 
/*     */   public static Map<Long, ShopInfo> listMap() {
/* 184 */     return listMap;
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.shopList.ShopMap
 * JD-Core Version:    0.5.3
 */